﻿// owner 蒋家伟

#pragma once
#include "IExcelReader.h"

// thirdparty
#define max(a,b) (((a) > (b)) ? (a) : (b))

#include "xlnt/xlnt.hpp"

namespace jsdk
{
    class ExcelReader : public IExcelReader
    {
    public:
        static OwnerPtr<ExcelReader> create(const std::wstring& fileName);
        ~ExcelReader();
    private: 
        // 继承IExcel
        virtual bool openSheet(uint64_t sheetIndex) override;
        virtual const std::wstring* getCellData(uint64_t row, uint64_t col) const override;
        virtual uint64_t getSheetRowCount() const override;
        virtual uint64_t getSheetColCount() const override;

        // owner
        ExcelReader() {};
    private:

        xlnt::workbook m_workBook{};
        xlnt::worksheet m_workSheet{};
        std::vector<std::vector<std::wstring>> m_excelData;
    };
}